package org.liveboardgames.agricola.control.delegates.mock.cards.actioncards
{
    import org.liveboardgames.agricola.control.delegates.mock.ActionFactory;
    import org.liveboardgames.agricola.model.enums.ActionOutputEnum;
    import org.liveboardgames.agricola.model.enums.ResourceZoneEnum;
    import org.liveboardgames.agricola.view.component.ImageHandler;
    import org.liveboardgames.agricola.vo.action.Action;
    import org.liveboardgames.agricola.vo.card.ActionCard;
    
    import mx.collections.ArrayCollection;
    import mx.collections.ListCollectionView;
    
    public class PeriodOneCards
    {
        public static const FENCES:ActionCard = getFencesCard();
        
        public static const IMPROVEMENT:ActionCard = getImprovementCard();
        
        public static const ONE_SHEEP:ActionCard = getOneSheepCard();
        
        public static const SOW_ANDOR_BAKE:ActionCard = getSowBakeCard();
        
        private static function getFencesCard():ActionCard
        {
            var card:ActionCard = new ActionCard();
            card.imagePath = ImageHandler.ACTIONS + "Fences.png";
            card.cardName = "Fences";
            
            // Build the actions
            var actions:ListCollectionView = new ArrayCollection();
            var action:Action = ActionFactory.getFencesAction();
            actions.addItem(action);
            
            card.actions = actions;
            return card;
        }
        
        private static function getImprovementCard():ActionCard
        {
            var card:ActionCard = new ActionCard();
            card.cardName = "Improvement";
            card.imagePath = ImageHandler.ACTIONS + "Improvement.png";
            
            // Build the actions
            var actions:ListCollectionView = new ArrayCollection();
            var action:Action = ActionFactory.getMajorImprovementAction();
            actions.addItem(action);
            
            card.actions = actions;
            return card;
        }
        
        private static function getOneSheepCard():ActionCard
        {
            var card:ActionCard = new ActionCard();
            card.cardName = "One Sheep";
            card.imagePath = ImageHandler.ACTIONS + "OneSheep.png";
            card.resourceZone = ResourceZoneEnum.BOTTOM;
            
            // Build the actions
            var actions:ListCollectionView = new ArrayCollection();
            var action:Action = ActionFactory.getResourceAction(ActionOutputEnum.SHEEP, 1, true);
            action.target = card;
            action.needPlayerInput = false;
            
            actions.addItem(action);
            
            // A peep can take all accumulated animals
            var takeAction:Action = ActionFactory.getTakeAnimalAction(card);
            actions.addItem(takeAction);
            
            card.actions = actions;
            return card;
        }
        
        private static function getSowBakeCard():ActionCard
        {
            var card:ActionCard = new ActionCard();
            card.cardName = "Sow and/or bake";
            card.imagePath = ImageHandler.ACTIONS + "SowAndOrBake.png";
            
            // Build the actions
            var actions:ListCollectionView = new ArrayCollection();
            
            var sowAction:Action = ActionFactory.getSowAction();
            var bakeAction:Action = ActionFactory.getBakeAction();
            
            actions.addItem(sowAction);
            actions.addItem(bakeAction);
            
            card.actions = actions;
            return card;
        }
    
    }
}